package com.flyco.modules.stm.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.flyco.poi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
@TableName("stm_distributor_group")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="stm_distributor_group对象", description="门店")
public class StmDistributorGroup {

    /**分组id*/
    @TableId(type = IdType.INPUT)
    @ApiModelProperty(value = "分组id")
    private Integer id;

    @ApiModelProperty(value = "分组名称")
    @JsonSerialize(using= ToStringSerializer.class)
    private String name;

    @ApiModelProperty(value = "分组编号")
    private String code;

    @ApiModelProperty(value = "状态")
    @JsonSerialize(using= ToStringSerializer.class)
    private Integer status;


    @Excel(name = "创建人", width = 15)
    @ApiModelProperty(value = "创建人")
    private String createUsername;

    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    /**更新人*/
    @Excel(name = "更新人", width = 15)
    @ApiModelProperty(value = "更新人")
    private String updateUsername;


    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    @TableField(exist = false)
    private String nameAndId;

    public String getNameAndId(){
        return this.name+"&:"+this.id;
    }

}
